package com.christina.engine.decision.model;

import com.alibaba.fastjson.JSONObject;
import com.christina.engine.intent.model.Intent;
import lombok.Data;
import lombok.Builder;
import lombok.Getter;

import java.util.Map;

/**
 * 决策请求模型
 * 
 * @author Christina
 */
@Data
@Builder
public class DecisionRequest {
    
    /**
     * 用户ID
     */
    private Long userId;

    /**
     * 请求id
     */
    private String requestId;
    
    /**
     * 会话ID
     */
    private String sessionId;
    
    /**
     * 识别的意图
     */
    private Intent intent;
    
    /**
     * 提取的参数
     */
    private JSONObject parameters;
    
    /**
     * 用户上下文
     */
    private Object userContext;
    
    /**
     * 对话上下文
     */
    private Object conversationContext;
    
    /**
     * 决策类型
     */
    private DecisionType decisionType;
    
    /**
     * 决策优先级
     */
    private DecisionPriority priority;
    
    /**
     * 约束条件
     */
    private JSONObject constraints;
    
    /**
     * 决策类型
     */
    @Getter
    public enum DecisionType {
        SERVICE_ROUTING("服务路由"),
        RESPONSE_GENERATION("响应生成"),
        TASK_SCHEDULING("任务调度"),
        RESOURCE_ALLOCATION("资源分配"),
        WORKFLOW_CONTROL("流程控制");
        
        private final String description;
        
        DecisionType(String description) {
            this.description = description;
        }

    }
    
    /**
     * 决策优先级
     */
    @Getter
    public enum DecisionPriority {
        LOW(1, "低优先级"),
        NORMAL(2, "普通优先级"),
        HIGH(3, "高优先级"),
        URGENT(4, "紧急优先级"),
        CRITICAL(5, "关键优先级");
        
        private final int level;
        private final String description;
        
        DecisionPriority(int level, String description) {
            this.level = level;
            this.description = description;
        }

    }
}